Component({
   /**
    * 组件的属性列表
    */
   properties: {

   },
   externalClasses: ['view-hover'],

   /**
    * 组件的初始数据
    */
   data: {
      opt: {
         show: false,
         list: [],
         type: "mpwSheet",
      }
   },

   /**
    * 组件的方法列表
    */
   methods: {
      show(opt) {
         console.log(opt)
         if (opt.list.length == 0) {
            console.error('Please add at least one menu')
            return;
         }
         if (opt.type != "mpwSheet"){
            console.error('sheet type error from Component methods show')
            return;
         }
         opt.show = true;
         this.setData({
            opt: opt
         })
         opt.success();
      },
      hide(opt) {
         this.data.opt.show = false;
         this.setData({
            opt: this.data.opt
         })
      },

      /**
       * sheet菜单点击事件
       */
      mpwSheetItemEvent(res) {
         let that = this,
            index = res.currentTarget.dataset.index,
            title = res.currentTarget.dataset.title;
         console.log('点击了：', title)
         let detail = {
            index: index,
            title: title
         };
         this.data.opt.success(detail);
         this.hide();
      },

      /**
       * 遮罩层点击事件
       */
      maskClickEvent() {
         this.hide();
      },

      /**
       * 遮罩点击事件
       */
      mpwSheetMask() {
         this.hide();
      },

      /**
       * sheet 取消
       */
      mpwSheetHide(){
         this.hide();
      },
   }
})